package com.zhentao.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

/**
 * 商品表
 * @TableName commodity
 */
@TableName(value ="commodity")
@Data
public class Commodity {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 商品编码
     */
    private String commodityCode;

    /**
     * 商品名称
     */
    private String commodityName;

    /**
     * 是否重点商品
     */
    private Integer isKeyCommodity;

    /**
     * 是否敏感商品
     */
    private Integer isSensitive;

    /**
     * 上级商品编码
     */
    private String parentCode;

    /**
     * 
     */
    private Integer isActive;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Commodity other = (Commodity) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getCommodityCode() == null ? other.getCommodityCode() == null : this.getCommodityCode().equals(other.getCommodityCode()))
            && (this.getCommodityName() == null ? other.getCommodityName() == null : this.getCommodityName().equals(other.getCommodityName()))
            && (this.getIsKeyCommodity() == null ? other.getIsKeyCommodity() == null : this.getIsKeyCommodity().equals(other.getIsKeyCommodity()))
            && (this.getIsSensitive() == null ? other.getIsSensitive() == null : this.getIsSensitive().equals(other.getIsSensitive()))
            && (this.getParentCode() == null ? other.getParentCode() == null : this.getParentCode().equals(other.getParentCode()))
            && (this.getIsActive() == null ? other.getIsActive() == null : this.getIsActive().equals(other.getIsActive()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getCommodityCode() == null) ? 0 : getCommodityCode().hashCode());
        result = prime * result + ((getCommodityName() == null) ? 0 : getCommodityName().hashCode());
        result = prime * result + ((getIsKeyCommodity() == null) ? 0 : getIsKeyCommodity().hashCode());
        result = prime * result + ((getIsSensitive() == null) ? 0 : getIsSensitive().hashCode());
        result = prime * result + ((getParentCode() == null) ? 0 : getParentCode().hashCode());
        result = prime * result + ((getIsActive() == null) ? 0 : getIsActive().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", commodityCode=").append(commodityCode);
        sb.append(", commodityName=").append(commodityName);
        sb.append(", isKeyCommodity=").append(isKeyCommodity);
        sb.append(", isSensitive=").append(isSensitive);
        sb.append(", parentCode=").append(parentCode);
        sb.append(", isActive=").append(isActive);
        sb.append("]");
        return sb.toString();
    }
}